<?php

/**
 * conference actions.
 *
 * @package    ldaad
 * @subpackage conference
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
 */
class conferenceActions extends autoconferenceActions
{

//  public function executeIndex()
//  {
//    $this->getResponse()->setSlot('sidebar', 'TEST TEST');
//    return parent::executeIndex();
//  }



  public function executeAddSession()
  {
    $session = new Session();
    $session->setConferenceId($this->getRequestParameter('id'));
    
    /**
    i add this setter parts since i do not know 
    how to ensure that only the FILLED session form is stored in the database
    if there is no setter... 
    once the user press 'BACK', the databse will be filled with junk data
    aditya
    */
    $session->setName('unnamed session');
    $session->setSessionCode('unassigned');
    $session->setDescription('no description for the session');
    $session->setTimeStart(time());
    $session->setTimeEnd(time());
    $session->setMaxEnroll('0');
    
    $session->save();
 
    $this->redirect('session/edit?id='.$session->getId());
    #$this->redirect('session/create?conference_id='.$this->getRequestParameter('id'));
  }
  
  public function executeSeeSession()
  {

    $this->redirect('session/list?filters[conference_id]=' . $this->getRequestParameter('id') . '&filter=filter');
  
  }

  
  public function executeAddSpecialEvent()
  {
    $specialEvent = new SpecialEvent();
    $specialEvent->setConferenceId($this->getRequestParameter('id'));
    
    /**
     see above
     aditya
    */
    
    $specialEvent->setName('unnamed special event');
    $specialEvent->setSpecialCode('unassigned');
    $specialEvent->setDescription('no description for the special event');
    $specialEvent->setTimeStart(time());
    $specialEvent->setTimeEnd(time());
    $specialEvent->setMaxEnroll('0');
    $specialEvent->setFee('0');
    
    $specialEvent->save();
 
    $this->redirect('specialEvent/edit?id='.$specialEvent->getId());
    
  }
  
  public function executeSeeSpecialEvent()
  {

    $this->redirect('specialEvent/list?filters[conference_id]=' . $this->getRequestParameter('id') . '&filter=filter');
  
  }  
  
  //for registration
  
  /*
  public function executeIndex()
  {
    return $this->forward('conference', 'selectConference');
  }
  */
  public function executeSelectConference()
  {
    //only show conference which is active
    $c = new Criteria();
    $c-> add(ConferencePeer::IS_ACTIVE, true);
    $this->conferences = ConferencePeer::doSelect($c);
  }
  
  
  public function executeRegisterConference()
  {
    $registeredConferenceID = $this->getRequestParameter('id');
    
    $this->getUser()->setAttribute('conferenceIDSession', $registeredConferenceID);
    
    return $this->redirect('publicRegistration/startRegistrant');
  }  
  


}
